<?php
session_start();
mysql_connect("localhost", "", "");
mysql_query("USE stats_syslog");
$domainsquery = mysql_query("SELECT domain FROM domains");
$count = mysql_num_rows($domainsquery);

echo "<html>\n";
echo "<head>\n";
echo "<title>Barracuda Spam Firewall Statistics per Domain - Overview</title>\n";
echo "</head>\n";
echo "<body>\n";
echo "<b>Per-Domain Statistics - Overview</b>\n";
echo "<br><br>\n";
echo "<table border=\"1\">\n";
echo "<tr>\n";
echo "<td><b>Top 10 Virus per Domain</b></td>\n";
echo "<td><b>Top 10 Recipients per Domain</b></td>\n";
echo "<td><b>Top DNS-Blacklists per Domain</b></td>\n";
echo "<tr>\n";
echo "<td>\n";

for ($domainnum=0;$domainnum<$count;$domainnum++)
{
  $currdomain = mysql_result($domainsquery,$domainnum,domain);
  echo "<a href=\"topvirus.php?domain=$currdomain\" target=\"_blank\">For Domain \"$currdomain\"</a>\n";
  echo "<br>\n";
}

echo "</td>\n";
echo "<td>\n";

for ($domainnum=0;$domainnum<$count;$domainnum++)
{
  $currdomain = mysql_result($domainsquery,$domainnum,domain);
  echo "<a href=\"toprecipients.php?domain=$currdomain\" target=\"_blank\">For Domain \"$currdomain\"</a>\n";
  echo "<br>\n";
}

echo "</td>\n";
echo "<td>\n";

for ($domainnum=0;$domainnum<$count;$domainnum++)
{
  $currdomain = mysql_result($domainsquery,$domainnum,domain);
  echo "<a href=\"topblacklists.php?domain=$currdomain\" target=\"_blank\">For Domain \"$currdomain\"</a>\n";
  echo "<br>\n";
}

echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</body>\n";
echo "</html>\n";
?>
